package Gui;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JComboBox;

import Gui.FontActions.MyFontSizeAction;

public class FontSizeListener implements ActionListener{
	private FontActions fontActions;
	
	@Override
	public void actionPerformed(ActionEvent e) {		
		if(e.getSource() instanceof JComboBox){
			JComboBox<Integer> source = (JComboBox<Integer>) e.getSource();
			MyFontSizeAction selSize = 
					getFontActions().new MyFontSizeAction("size",
							Integer.parseInt(source.getSelectedItem().toString()));
			//trigger defined size action
			selSize.actionPerformed(e);
		}
	}
	
	public FontSizeListener(FontActions fontActions){
		setFontActions(fontActions);
	}

	public FontActions getFontActions() {
		return fontActions;
	}

	public void setFontActions(FontActions fontActions) {
		this.fontActions = fontActions;
	}

}
